package com.sjy.ylxt.enums;

public enum AppointmentStatus {
    UNRESERVED(0, "待审核"),
    RESERVED(1, "已预约"),
    CANCELLED(2, "已取消"),
    COMPLETED(3, "已完成"),
    REJECTED(4, "已拒绝");

    private final int code;
    private final String description;

    AppointmentStatus(int code, String description) {
        this.code = code;
        this.description = description;
    }

    public int getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AppointmentStatus fromCode(int code) {
        for (AppointmentStatus status : AppointmentStatus.values()) {
            if (status.getCode() == code) {
                return status;
            }
        }
        throw new IllegalArgumentException("Unknown appointment status code: " + code);
    }
}
